package main

import (
	"github.com/hajimehoshi/ebiten"
	"github.com/hajimehoshi/ebiten/ebitenutil"
	"image"
)

type GameReady struct {
	imgReady1 *ebiten.Image
	img1X int
	img1Y int
	imgReady2 *ebiten.Image
	img2X int
	img2Y int

}


func (g *Game) DrawReady(screen *ebiten.Image)  {
	g.DrawBegin(screen)

	imageObject1, _, _ := ebitenutil.NewImageFromFile("imgs/title.png",ebiten.FilterDefault)

	imageObject2, _, _ := ebitenutil.NewImageFromFile("imgs/start.png",ebiten.FilterDefault)


	gameReady := &GameReady{
		imgReady1: imageObject1,
		img1X: 370,
		img1Y: 140,
		imgReady2: imageObject2,
		img2X: 333,
		img2Y: 200,
	}

	op := &ebiten.DrawImageOptions{}
	op.GeoM.Translate(float64(gameReady.img1X),float64(gameReady.img1Y))
	screen.DrawImage(gameReady.imgReady1,op)

	op.GeoM.Reset()
	op.GeoM.Translate(float64(gameReady.img2X),float64(gameReady.img2Y))
	screen.DrawImage(gameReady.imgReady2,op)
	//ebitenutil.DrawRect(screen , float64(gameReady.img2X), float64(gameReady.img2Y),200 , 30,color.White)

	if ebiten.IsMouseButtonPressed(ebiten.MouseButtonLeft) {
		x,y := ebiten.CursorPosition()
		rect := image.Rect(gameReady.img2X,gameReady.img2Y,gameReady.img2X+200,gameReady.img2Y+30)
		if (x >=rect.Min.X && x<=rect.Max.X && y>=rect.Min.Y && y<= rect.Max.Y ){
			gameState = 1
		}
	}

}

